package org.nowcoder.huawei.c100;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class HC042 {
    static class Alpha implements Comparable<Alpha> {
        private char c;
        private int count;

        Alpha(char c, int count) {
            this.c = c;
            this.count = count;
        }

        @Override
        public int compareTo(Alpha o) {
            if (this.count == o.count) {
                return this.c - o.c;
            } else {
                return o.count - this.count;
            }
        }

        @Override
        public String toString() {
            return c + "" + count;
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        solve(line);
    }

    public static void solve(String line) {
        List<Alpha> results = new ArrayList<>();
        for (int i = 0; i < line.length(); i++) {
            char c = line.charAt(i);
            if (Character.isLetter(c)) { //去除非字母符号
                // 字符串连续
                c = Character.toLowerCase(c);
                if (i + 1 < line.length() && c == line.charAt(i + 1)) {
                    int count = 1;
                    for (int j = i + 1; j < line.length(); j++) {
                        char var = line.charAt(j);
                        if (!Character.isLetter(var)) {
                            continue;
                        }
                        var = Character.toLowerCase(var);
                        if (c == var) {
                            count++;
                        } else {
                            break;
                        }
                    }
                    i = i + count - 1;
                    results.add(new Alpha(c, count));
                } else {
                    int count = 0;
                    for (int j = i + 1; j < line.length(); j++) {
                        if (c == Character.toLowerCase(line.charAt(j))) {
                            count++;
                        }
                    }
                    results.add(new Alpha(c, count));
                }
            }
        }
        Collections.sort(results);
        results.forEach(System.out::print);
    }
}
